# -*- coding: utf-8 -*-


cookie = 'pgv_pvid=6221761244; fqm_pvqid=11932252-002d-4d97-aa3e-5092bf99720a; RK=Mi9Z9nECdq; ptcz=698475f8c2d11a6d10d47f079f1927b516dc2434433b13c911d5fd3dbb9aa72a; eas_sid=P1g7h1Y4E3k2Q008W4Z0Z5B900; LW_sid=S1C7f1v5K85761z5h2I8F8L0G0; LW_uid=u1l7G1d5z8Q741O5s2Q8j8t0t1; _clck=ls1zxw|1|fns|0; __Q_w_s__QZN_TodoMsgCnt=1; qq_domain_video_guid_verify=9451c41f5060c138; _qimei_uuid42=18913103406100f362cb56a711b6c225f17064cf77; _qimei_fingerprint=dc9ac778ca4a0d5c5ac6719cf470d572; _qimei_q36=; _qimei_h38=19c59bcf62cb56a711b6c22502000004218913; _qpsvr_localtk=0.34156399737267806; pgv_info=ssid=s2723199860; uin=o1836189218; skey=@Dqnq4J6CR; p_uin=o1836189218; pt4_token=sXrm3H3XzNUK8J5M7UJxgAMShO84tT7eACt9Hy01kmU_; p_skey=ntC7bAcrB*Rp2XMg5n-hv*ieyQJ3hkICzOrWTLcUUKM_; Loading=Yes; qzmusicplayer=qzone_player_1836189218_1727181014589; qqmusic_uin=1836189218; qqmusic_key=@Dqnq4J6CR; qqmusic_fromtag=6'

"""
key
value
dic = {'pgv_pvid':6221761244}
1. 每一组数据都是用;隔开
"""

# print(dict(cookie))
lst = cookie.split('; ')  # 分割出来的是列表
dic = {} # 定义一个新的字典
for i in lst:
    # print(i.split('='))
    data = i.split('=') # 拿每一组数据的 key  value
    # print(data)
    key = data[0]  # 取第一个值
    value = data[1] # 取第二个值
    dic[key] = value  # 往字典当中添加一组数据
    # print(key, value)

# print(dic)

# 跟上面的作对比
# {key:value for 新变量 in 序列}
cookies = {cookiea.split('=')[0]:cookiea.split('=')[1] for cookiea in cookie.split('; ')}
print(cookies)

# lst = [1,2,3,4,5,6,7,8,9]
# print(lst[0], lst[-1])
